package com.ghc.action;

import java.util.ArrayList;

import com.ghc.dao.ImgDao;
import com.ghc.pojo.Img;
import com.google.gson.Gson;

public class ImgAction{
	

	private ImgDao imgDao;
	private Img img = new Img();
	ArrayList<Img> picList = new ArrayList<Img>();
	
	private String result;
	
	public String showPicTurn(){
		picList = imgDao.showPicTurn();
		return "success";
	}
	
	public String showAboutPic(){
		picList = imgDao.showAboutPic();
		return "success";
	}
	
	public String showImgInfo(){
		img = imgDao.showImgInfo(img.getId());
		if(img.getJumpurl().length()==0){
			img.setJumpurl("无");
		}
		result = new Gson().toJson(img);
		return "success";
	}
	
	public String editImgInfo(){
		imgDao.editImgInfo(img);
		result = "bingo";
		return "success";
	}
	
	public ArrayList<Img> getPicList() {
		return picList;
	}

	public void setPicList(ArrayList<Img> picList) {
		this.picList = picList;
	}

	public ImgDao getImgDao() {
		return imgDao;
	}

	public void setImgDao(ImgDao imgDao) {
		this.imgDao = imgDao;
	}

	public Img getImg() {
		return img;
	}

	public void setImg(Img img) {
		this.img = img;
	}

	public String getResult() {
		return result;
	}

	public void setResult(String result) {
		this.result = result;
	}

}
